home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / telecomm / fido / pltflm02.lha / PlutFLOMove.lst < prev    next >
Encoding:
File List  |  1994-10-25  |  3.4 KB  |  177 lines

  1. MODE 1
  2. '
  3. ' Plutonic FLO file mover
  4. '
  5. ' This source is copyright!  All rights reserved.
  6. '
  7. ' If any parts of it are used in other programs, acknowledgement
  8. ' must be given to Peter Deane (3:622/401)
  9. '
  10. argprob%=0
  11. arg$=_dosCmd$
  12. arg$=TRIM$(arg$)
  13. '
  14. versnum$="$VER: PlutFLOMove 0.2 "
  15. versnum$="0.2"
  16. versdate$="25-Oct-94"
  17. '
  18. esc$=CHR$(27)
  19. ansi0$=esc$+"[0m"
  20. ansi1$=esc$+"[31m"
  21. ansi2$=esc$+"[32m"
  22. ansi3$=esc$+"[33m"
  23. '
  24. OPEN "O",#1,"*",1
  25. '
  26. '
  27. aa%=INSTR(arg$," ")
  28. '
  29. IF aa%=0
  30.   argprob%=1
  31. ENDIF
  32. '
  33. indir$=TRIM$(LEFT$(arg$,aa%))
  34. outdir$=TRIM$(MID$(arg$,aa%,255))
  35. '
  36. IF RIGHT$(indir$,1)<>"/" AND RIGHT$(indir$,1)<>":"
  37.   indir$=indir$+"/"
  38. ENDIF
  39. IF RIGHT$(outdir$,1)<>"/" AND RIGHT$(outdir$,1)<>":"
  40.   outdir$=outdir$+"/"
  41. ENDIF
  42. '
  43. IF INSTR(arg$,"?")
  44.   argprob%=9
  45. ELSE IF LEN(arg$)<3
  46.   argprob%=1
  47. ELSE IF NOT EXIST(indir$)
  48.   argprob%=2
  49. ELSE IF NOT EXIST(outdir$)
  50.   argprob%=3
  51. ENDIF
  52. '
  53. PRINT #1,""
  54. PRINT #1,ansi2$+"------------------------"
  55. PRINT #1,ansi0$+"Plutonic .?LO File Mover"
  56. PRINT #1,ansi2$+"------------------------"
  57. PRINT #1,ansi0$+"    Version "+ansi3$+versnum$
  58. PRINT #1,"     (c) "+ansi2$+versdate$
  59. PRINT #1,ansi3$+"     By Peter Deane"
  60. PRINT #1,ansi2$+"------------------------"
  61. RELSEEK #1,0
  62. '
  63. IF argprob%>0
  64.   '
  65.   IF argprob%=1
  66.     PRINT #1,"Short or no directory names given"
  67.   ELSE IF argprob%=2
  68.     PRINT #1,"Source directory does not exist"
  69.   ELSE IF argprob%=3
  70.     PRINT #1,"Output directory does not exist"
  71.   ELSE IF argprob%=9
  72.     PRINT #1,CHR$(34)+"?"+CHR$(34)+" given in command line"
  73.   ENDIF
  74.   PRINT #1,ansi3$+"Usage details: "
  75.   PRINT #1,""
  76.   PRINT #1,ansi0$+"PlutFLOMove "+ital$+"<Source Dir> <Output Dir>"+ansi0$
  77.   GOTO cleanup
  78. ENDIF
  79. '
  80. '
  81. PRINT #1,"Scanning dir: "+CHR$(34)+indir$+CHR$(34)+"..."
  82. RELSEEK #1,-1
  83. '
  84. DIR indir$ TO "ram:PlutFLOMove.tmp"
  85. IF NOT EXIST("Ram:PlutFLOMove.tmp")
  86.   PRINT #1,"No files in search directory"
  87.   RELSEEK #1,-1
  88.   GOTO cleanup
  89. ENDIF
  90. '
  91. OPEN "I",#3,"Ram:PlutFLOMove.tmp",1024
  92. WHILE NOT EOF(#3)
  93.   LINE INPUT #3,xx$
  94.   PRINT #1,ansi3$+xx$;
  95.   @spaceout(xx$,21)
  96.   PRINT #1,SPACE$(spc%);
  97.   RELSEEK #1,-1
  98.   xxu$=UPPER$(xx$)
  99.   ismail!=FALSE
  100.   '
  101.   IF RIGHT$(xxu$,4)=".FLO"
  102.     ismail!=TRUE
  103.   ELSE IF RIGHT$(xxu$,4)=".DLO"
  104.     ismail!=TRUE
  105.   ELSE IF RIGHT$(xxu$,4)=".CLO"
  106.     ismail!=TRUE
  107.   ELSE IF RIGHT$(xxu$,4)=".HLO"
  108.     ismail!=TRUE
  109.   ELSE
  110.     PRINT #1,CHR$(10)+esc$+"[A"+esc$+"[K";
  111.     RELSEEK #1,-1
  112.     GOTO notmail
  113.   ENDIF
  114.   '
  115.   OPEN "I",#9,indir$+xx$,24
  116.   lq%=LOF(#9)
  117.   IF lq%=0
  118.     PRINT #1,CHR$(10)+esc$+"[A"+esc$+"[K";
  119.     RELSEEK #1,-1
  120.   ELSE
  121.     '
  122.     PRINT #1,ansi1$+" -> "+ansi2$+outdir$+xx$
  123.     RELSEEK #1,-1
  124.     IF EXIST(outdir$+xx$)
  125.       OPEN "A",#8,outdir$+xx$
  126.     ELSE
  127.       OPEN "A",#8,outdir$+xx$
  128.     ENDIF
  129.     WHILE NOT EOF(#9)
  130.       LINE INPUT #9,inflo$
  131.       PRINT #8,inflo$
  132.     WEND
  133.     CLOSE #8
  134.   ENDIF
  135.   CLOSE #9
  136.   IF EXIST(indir$+xx$)
  137.     KILL indir$+xx$
  138.   ENDIF
  139.   '
  140.   '
  141.   notmail:
  142. WEND
  143. CLOSE #3
  144. '
  145. cleanup:
  146. '
  147. PRINT #1,""
  148. PRINT #1,"Peter Deane"+ansi3$+"           Fido: "+ansi2$+"3:622/401"+ansi3$
  149. PRINT #1,"PO Box 228 Swansea NSW 2281 Australia"
  150. CLOSE #1
  151. '
  152. IF EXIST("Ram:PlutFLOMove.tmp")
  153.   KILL "RAM:PlutFLOMove.tmp"
  154. ENDIF
  155. END
  156. '
  157. PROCEDURE spaceout(thing$,col%)
  158.   '
  159.   LOCAL xx$,xx%,xq%,result%
  160.   xx%=FRE(1)
  161.   ' [Needs the string to format, and the column width it's going to]
  162.   ' [Returns spc% - the number of spaces required - 1 if field overflow]
  163.   '
  164.   xx$=thing$
  165.   xx%=col%
  166.   xq%=LEN(xx$)
  167.   IF xq%>xx%
  168.     result%=1
  169.   ELSE
  170.     result%=(xx%-xq%)
  171.   ENDIF
  172.   spc%=result%
  173.   '
  174. RETURN
  175. '
  176. '
  177.